/*
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 * 
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU Library General Public License for more details.
 * 
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin Street, Fifth Floor Boston, MA 02110-1301,  USA
 */

/**
 * @version bspd.h 0.0.1
 * @package Comoro
 * @author Dr.NP <np@bsgroup.org>
 * 
 * BSPD main header file
 */

#include "base.h"
#include "bridge.h"
#include "center.h"
#include "coin.h"
#include "conf.h"
#include "conn.h"
#include "db_mysql.h"
#include "func.h"
#include "mempool.h"
#include "log.h"
#include "login.h"
#include "package.h"
#include "queue.h"
#include "runner.h"
#include "status.h"
#include "thread.h"

/* RUNTIME */
#define BSP_VERSION						"Alpha9-Build.20091124"

/* RETURN VALUES */
#define EXIT_SUCCESS						0
#define EXIT_UNKNOWN						-1
#define EXIT_GENERAL						-2

#define EXIT_SOCKET_CREATE_ERROR		1
#define EXIT_SOCKET_BIND_ERROR			2
#define EXIT_SOCKET_LISTEN_ERROR		3
#define EXIT_SOCKET_NONBLOCK_ERROR		4
#define EXIT_SOCKET_CONNECT_ERROR		5

#define EXIT_IO_ERROR					10
#define EXIT_SIGNAL_ERROR				11
#define EXIT_MEMORY_ERROR				12
#define EXIT_PIPE_ERROR					13
#define EXIT_THREAD_ERROR				14
#define EXIT_DB_ERROR					15

#define EXIT_CONFIG_FILE_NOT_FOUND		21

#define RTN_SUCCESS						0
#define RTN_UNKNOWN						-1
#define RTN_GENERAL						-2
#define RTN_IO_ERROR						-10
#define RTN_SIGNAL_ERROR					-11
#define RTN_MEMORY_ERROR					-12
#define RTN_PIPE_ERROR					-13
#define RTN_DB_ERROR						-14

/* SPECIAL PACKAGE */
#define SGN_RANGE							0xffffff00

#define SGN_HEARTBEAT					0xffffffff
#define SGN_SEQ_RESPONSE					0xfffffffe
#define SGN_SEQ_REQUEST					0xfffffffd
#define SGN_SET_SRVID					0xfffffffc

#define SGN_CMD_LOGIN					0xfffffffb
#define SGN_CMD_BASE_LIST				0xfffffffa
#define SGN_CMD_STATUS					0xfffffff6
#define SGN_CMD_CONN						0xfffffff5
#define SGN_CMD_VALIDATE					0xfffffff4

#define SGN_BASE_INFO					0xfffffff7
#define SGN_SESSION_DATA					0xfffffff8

#define SGN_BASE_UNREG					0xfffffff3
#define SGN_BASE_REG						0xfffffff2
#define SGN_CLIENT_UNREG					0xfffffff1
#define SGN_CLIENT_REG					0xfffffff0
